package javaVersion.learn.batchProcess;

import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.operators.DataSource;
import org.apache.flink.core.fs.FileSystem;

import java.util.ArrayList;

public class Pro5_Write2File {
    public static void main(String[] args) throws Exception {
        ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
        ArrayList<String> list = new ArrayList<>();
        list.add("a");
        list.add("a");
        list.add("a");
        list.add("bb");
        list.add("bb");
        list.add("c");
        DataSource<String> source = env.fromCollection(list);
        source.setParallelism(1).writeAsText("MyFlinkFile.txt", FileSystem.WriteMode.OVERWRITE);
        env.execute();
    }
}
